<?php

namespace App\Constants;

/**
 * 合同类型枚举
 * 定义各种劳动合同类型
 */
class ContractTypeEnum extends AbstractEnum
{
    // 合同类型常量
    public const LABOR_CONTRACT = 'labor_contract';
    public const FIXED_TERM = 'fixed_term';
    public const INDEFINITE_TERM = 'indefinite_term';
    public const PROJECT_CONTRACT = 'project_contract';
    public const TEMPORARY_CONTRACT = 'temporary_contract';
    public const RETIREE_CONTRACT = 'retiree_contract';
    public const PROBATION_CONTRACT = 'probation_contract';

    /**
     * 获取所有枚举实例
     */
    public static function getAll(): array
    {
        return [
            new self('labor_contract', '劳动合同', '标准劳动合同', '#28A745', 'file-contract', 1),
            new self('fixed_term', '固定期限合同', '有固定期限的劳动合同', '#17A2B8', 'calendar-alt', 2),
            new self('indefinite_term', '无固定期限合同', '无固定期限的劳动合同', '#6C757D', 'infinity', 3),
            new self('project_contract', '项目合同', '基于特定项目的劳动合同', '#FFC107', 'project-diagram', 4),
            new self('temporary_contract', '临时合同', '临时性劳动合同', '#FD7E14', 'clock', 5),
            new self('retiree_contract', '退休返聘合同', '退休人员返聘劳动合同', '#DC3545', 'user-clock', 6),
            new self('probation_contract', '试用合同', '试用期劳动合同', '#E83E8C', 'hourglass-half', 7),
        ];
    }

    /**
     * 获取正式合同类型
     */
    public static function getFormalContracts(): array
    {
        return [
            self::LABOR_CONTRACT,
            self::FIXED_TERM,
            self::INDEFINITE_TERM,
        ];
    }

    /**
     * 获取临时合同类型
     */
    public static function getTemporaryContracts(): array
    {
        return [
            self::PROJECT_CONTRACT,
            self::TEMPORARY_CONTRACT,
            self::PROBATION_CONTRACT,
        ];
    }

    /**
     * 检查是否为正式合同
     */
    public static function isFormalContract(string $type): bool
    {
        return in_array($type, self::getFormalContracts());
    }

    /**
     * 检查是否为临时合同
     */
    public static function isTemporaryContract(string $type): bool
    {
        return in_array($type, self::getTemporaryContracts());
    }
}
